import random  # 借工具：引入别人写好的代码
p_win = 0  # 玩家获胜的次数
c_win = 0  # 计算机获胜的次数
# 当玩家获胜次数和计算机获胜次数都比2小，游戏继续
while p_win < 2 and c_win < 2:
    computer = random.choice(["shitou", "jiandao", "bu"])
    print(computer)
    player = input("shitou/jiandao/bu: ")
    # 玩家获胜的情况
    win_list = [
        ["shitou","jiandao"],["jiandao","bu"],["bu","shitou"]
    ]
    now = [player, computer]
    if now in win_list:
        p_win += 1
        print("player win~")
    elif player == computer:
        print("ping ju")
    else:
        c_win += 1
        print("computer win~")
        





#if player == "shitou":  # player: 石头
#    if computer == "shitou":
#        print("平局")
#    elif computer == "jiandao":
#        print("player win~")
#    else:  # computer: bu
#        print("computer win~")
#elif player == "jiandao":
#    if computer == "shitou":
#        print("computer win~")
#    elif computer == "jiandao":
#        print("ping ju")
#    else:  # computer: bu
#        print("player win~")
#else:  # player: bu
#    if computer == "shitou":
#        print("player win~")
#    elif computer == "jiandao":
#        print("computer win~")
#    else:  # computer: bu
#        print("ping ju")







